package com.partsoft.spring.webapp.zks;

import java.util.Iterator;
import java.util.List;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventThreadCleanup;

import com.partsoft.spring.log.Log;

@SuppressWarnings({"unchecked", "rawtypes"})
public class ExceptionInterceptor implements EventThreadCleanup {

	public void cleanup(Component comp, Event evt, List errs)
			throws Exception {
		if (errs != null && !errs.isEmpty()) {
			Iterator<Object> eIt = errs.iterator();
			while(eIt.hasNext()) {
				Log.error((Throwable)eIt.next());
			}
		}
	}

	public void complete(Component component, Event event) throws Exception {
		
	}

}
